home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 934 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1011 b 

  1. Path: news.worldlinx.com!stupy
  2. From: stupy@freenet.durham.org (Steve Tupy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What is '?' in C mean....?????
  5. Date: 10 Jan 1996 07:16:29 GMT
  6. Organization: Durham Free-Net
  7. Message-ID: <4cvp4d$b6u@news.worldlinx.com>
  8. References: <4cgsa8$bm2@wumpus.cc.uow.edu.au>
  9. NNTP-Posting-Host: freenet.durham.org
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. PAOPENG THEERADECH (tp86@wumpus.cc.uow.edu.au) wrote:
  13. : Hello to all.
  14. :     I got something here to ask you guys. I saw some symbol like "?" be
  15. : used in some codes. I don't understand what does it mean. I tried to read some
  16. : text books but I still cannot find the detail about "?". The codes that I saw 
  17. : are;
  18. :         max = x>y ? x:y;
  19. :          
  20. :             and
  21.  
  22. :         printf("%d", x>y ? x:y);
  23.  
  24. It tells you that an evaluation is about to happen. If x>y then max = x, if
  25. x>y == 0 then max = y. The first value left of the colon is applied only if
  26. it evaluates to 1, else the right side is applied.
  27.  
  28. Cryptic, but it should help you out...
  29.  
  30. Take care!
  31.  
  32. --
  33. Steve
  34.